<template>
  <div class="collect">
    <!-- 收藏 -->
    <div class="collect-header">
      <div class="collect-title">
        <i class="el-icon-collection-tag" style="color: rgb(255, 103, 0)"></i>
        我的收藏
      </div>
    </div>
    <div class="content">
      <div v-show="!collectList.length" class="collect-empty">
        <div class="empty">
          <h2>您的收藏还是空的！</h2>
          <p>快去购物吧</p>
        </div>
      </div>
      <my-list
        :listData="collectList"
        :moreShow="true"
        :isDelete="true"
        v-show="collectList.length"
      ></my-list>
    </div>
  </div>
</template>
<script>
import axios from "@/api/detailsApi";
export default {
  data() {
    return {
      collectList: [],
    };
  },
  created() {
    this.getCollect();
  },
  methods: {
    // 获取用户收藏数据
    async getCollect() {
      let obj = { user_id: this.$store.state.userId };
      let { data: res } = await axios.collect(obj);
      console.log(res);
      if (res.code == "001") this.collectList = res.collectList;
    },
  },
};
</script>
<style lang="scss" scoped>
.collect {
  background-color: #f5f5f5;
}
.collect-header {
  margin-top: 20px;
  height: 64px;
  background-color: #fff;
  border-bottom: 2px solid #ff6700;
  .collect-title {
    width: 1225px;
    margin: 0 auto;
    height: 64px;
    line-height: 58px;
    font-size: 28px;
  }
}

.content {
  min-height: 500px;
  padding: 20px 0;
  width: 1225px;
  margin: 0 auto;
  .collect-empty {
    width: 1225px;
    margin: 0 auto;
    .empty {
      height: 300px;
      padding: 0 0 130px 558px;
      margin: 65px 0 0;
      background: url("../../assets/imgs/cart-empty.png") no-repeat 124px 0;
      color: #b0b0b0;
      overflow: hidden;
      h2 {
        margin: 70px 0 15px;
        font-size: 36px;
      }
      p {
        margin: 0 0 20px;
        font-size: 20px;
      }
    }
  }
}
</style>
